package com;

import com.sun.javafx.webkit.WebConsoleListener;
import com.util.ControllerManager;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.event.EventHandler;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.web.WebView;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
import com.util.FxmlUtil;
import javafx.stage.WindowEvent;

import java.io.File;
import java.util.List;

public class Main extends Application {

    @Override
    public void start(Stage primaryStage) throws Exception {
        WebView web = new WebView();
        System.out.println("Java版本：" + System.getProperty("java.runtime.version"));
        System.out.println("JavaFX版本：" + System.getProperty("javafx.runtime.version"));
        System.out.println("系统版本：" + System.getProperty("os.name") + ", " + System.getProperty("os.arch"));
        System.out.println("浏览器版本：" + web.getEngine().getUserAgent());

        Thread.currentThread().setUncaughtExceptionHandler((thread, throwable) -> System.out.println("捕获到异常: " + throwable.getMessage()));
        primaryStage.setOnCloseRequest(event -> System.out.print("监听到窗口关闭"));

        WebConsoleListener.setDefaultListener((webView, message, lineNumber, sourceId) -> System.out.println(message + "  [" + sourceId + ":" + lineNumber + "] "));

        ControllerManager.init(primaryStage);
    }


    public static void main(String[] args) {
        launch(args);
    }
}
